const App = {
    mixins: [Query],//配置文件，路径/utils/mixins.js
    data() {
        return {
            photo,
            page: {
                value1: '',
                PageNumber: 1, //页码
                RowAmount: 20,
                Condition: window.btoa(unescape(encodeURIComponent("%%")))
            },
            str1: '',
            str: '',
        }
    },
    mounted() {

    },
    methods: {
        check() {
            this.page.Condition = window.btoa(unescape(encodeURIComponent("%" + this.page.value1 + "%")));
            this.postgetList(this.page);
        },
        postgetList(page) {
            const that = this;
            $.ajax({
                headers: requestHeaders(),
                url: `${mh}/generalBusiness/generalPaginationQueryBySQLSerialNumber`,
                method: "post",
                data: {
                    Model_Url: this.relativePath,
                    Condition: page.Condition,
                    PaginationNumber: page.PageNumber,
                    ...page
                },
                success: (res) => {
                    that.Total = res.TotalRows;//总数量
                    that.loading = false;
                    that.Tabletdata = res.Rows;
                },
                complete: (XMLHttpRequest) => {
                    requestPretreatment(XMLHttpRequest)
                },
            });
        },
        handleShow(row) { //详情
            $.ajax({
                headers: requestHeaders(),
                url: `${mh}/generalBusiness/generalQueryByTableName`,
                method: "post",
                data: {
                    Data: 'base_operation_log',
                    Condition: `Operation_SerialNumber='${row.Operation_SerialNumber}'`
                },
                success: (data) => {
                    const h = this.$createElement;
                    this.$msgbox({
                        title: '查看提交JSON数据',
                        message: h('div', null, [
                            h('div', {
                                style: `padding:10px; 
                                border:1px solid #000;height:25vh;
                                border-radius: 4px;overflow: auto;`
                            }, data[0].Operation_Main),
                        ]),
                        showCancelButton: true,
                        closeOnClickModal: false,
                        confirmButtonText: '复制',
                        cancelButtonText: '关闭',
                        beforeClose: (action, instance, done) => {
                            if (action === 'confirm') {
                                // 点击确认时复制内容
                                navigator.clipboard.writeText(data[0].Operation_Main).then(() => {
                                    this.$message.success('复制成功！');
                                }).catch(err => {
                                    this.$message.error('复制失败，请手动复制！');
                                });
                            } else {
                                done(); // 点击取消时直接关闭
                            }
                        }
                    }).then(() => { }).catch(() => { });
                },
                complete: (XMLHttpRequest) => {
                    requestPretreatment(XMLHttpRequest)
                },
            });
        }
    },
};

const { createApp } = Vue;
const app = createApp(App);
//这种方式是引入全部图标，无需单个引入
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component);
}
const ElMessage = ElementPlus.ElMessage;
app.use(ElementPlus, { locale: zhCn });
app.mount("#app");
